<template>
  <el-config-provider :size="size" :locale="zhCn">
    <RouterView />
  </el-config-provider>
</template>

<script setup>
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import useAppStore from './stores/modules/app'
import { findCustomers, getContractList, GetInventory2,findDepts, login } from '@/api/base'
import {cubasdocStore} from "@/stores/modules/cubasdoc";
import { ElMessage } from 'element-plus'

defineOptions({ name: 'App' })

const cubasdoc = cubasdocStore()

onMounted(() => {
  getCustomers()
})


//获取单位
async function getCustomers() {
  let userInfo ={
    'UserName':'1583',
    'Password':'zoutao0311',
    'UnID':2
  }

  // await login(userInfo);


  //获取公司信息


  const {Data} = await findCustomers()
  cubasdoc.setData(Data)

  let queryData={
    "ContractType":null,
    "CustCode":null,
    "CustName":null,
    "ContractNum":null,
    "CreateFrom":null,
    "CreateTo":null,
    "Type":null,
    "IsMoudels":false,
    "State":'2',
    "CreateBy":null,
  }
  // //获取合同信息
  let contractData = await getContractList(queryData)
  cubasdoc.setContractList(contractData.Data)

  //获取存货信息
  let invData={
    Code:'',
    Name:'',
  }
  let inventoryData = await GetInventory2(invData)
  cubasdoc.setInventoryList(inventoryData.data)





  let deptData = await findDepts()
  cubasdoc.setDepts(deptData)
}

const appStore = useAppStore()
const size = computed(() => appStore.size)
</script>
